<!DOCTYPE html>
<html>
<head>
<title>PLAYER!</title>
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
	<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
	<script src="./js/init.js"></script>
	<script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
</head>
<body>
	<div data-role="page" id="player-page" data-add-back-btn="true">
		<script>
			$('#player-page').live('pageshow',function(event) {
				var id = sessionStorage.selectedPlayerId
				$.getJSON("../rest/players/" + id, function(player){
					var playerDetails = $("#playerdetails")
					playerDetails.html(renderPlayer(player))
					playerDetails.listview('refresh')
				});
			});
			
			function renderPlayer(player){
				return '  <li data-role="list-divider">' + player.playername + '</li>'
					+ '  <li>real name: ' + player.prename + ' ' + player.name + '</li>'
					+ '  <li><a href="mailto:' + player.email + '">' + player.email + '</a></li>'
			}
			
		</script>
		<div data-role="header" data-position="fixed">
			<h1>Player details</h1>
		</div>

		<div data-role="content" id="player-content">
			<ul data-role="listview" id="playerdetails">
			</ul>
		</div>
		
	  <div data-role="footer" data-id="playerfooter" data-position="fixed"> 
	    <div data-role="navbar"> <!-- navbar's hrefs must match to pages' id -->
	    	<ul>
	    		<li><a href="#home" data-icon="home">Home</a></li>
	    		<li><a href="gameactions.html" data-icon="gear" class="ui-btn-active ui-state-persist">Games</a></li>
	    		<li><a href="rankings.html" data-icon="gear">Ranks</a></li>
	    	</ul>
	    </div>    
	  </div>
		
	</div>
</body>
</html>